package com.ylw.project.constant;

import org.apache.commons.lang3.StringUtils;

/**
 * @Description
 * @Author away
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2019/11/10
 */
public enum Project2CodeNameMappingEnum {

    DEFAULT("DEFAULT","default",""),


            ;

    String projectName;
    String codeRealDirName;
    String ip;//发布到对应的ip用;分割，暂时未使用，且不可以将ip暴露

     Project2CodeNameMappingEnum(String projectName, String codeRealDirName, String ip) {
        this.projectName = projectName;
        this.codeRealDirName = codeRealDirName;
        this.ip = ip;
    }


    public static Project2CodeNameMappingEnum getCodeNameByProjectName(String projectName){
        if(StringUtils.isEmpty(projectName)){
            return DEFAULT;
        }
        for(Project2CodeNameMappingEnum project2CodeNameMapping: Project2CodeNameMappingEnum.values()){
            if(project2CodeNameMapping.getProjectName().equals(projectName)){
                return project2CodeNameMapping;
            }
        }
        return DEFAULT;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getCodeRealDirName() {
        return codeRealDirName;
    }

    public void setCodeRealDirName(String codeRealDirName) {
        this.codeRealDirName = codeRealDirName;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }
}
